<!-- 首页里的推荐页面 -->
<template>
  <div id="homeRecommend">
    <div class="content_left_box">
      <!-- 左边头部 -->
      <div class="left_head_box">
        <router-link to="/home/recommend" class="head_btn_box_link"><div class="head_btn_box"><span class="head_btn_box_p" :style="selectStyle">推荐</span></div></router-link>
        <router-link to="/home/follow" class="head_btn_box_link"><div class="head_btn_box"><span class="head_btn_box_p">关注</span></div></router-link>
        <router-link to="/home/hotList" class="head_btn_box_link"><div class="head_btn_box"><span class="head_btn_box_p">热榜</span></div></router-link>
      </div>
      <!-- 左边内容切换 -->
      <div class="left_body_box">
        <HomeRecommendCardBox v-for="(i, index) of testList" :key="index" :cardList="i" @getNewCommentData="getNewCommentData"></HomeRecommendCardBox>
      </div>
    </div>
  </div>
</template>

<script>
import HomeRecommendCardBox from './homeCard/HomeRecommendCardBox'
export default {
  name: 'homeRecommend',
  el: '#homeRecommend',
  components: {
    'HomeRecommendCardBox': HomeRecommendCardBox
  },
  data () {
    return {
      selectStyle: {'color': '#0084ff'},
      testList: []
    }
  },
  computed: {
  },
  methods: {
    getNewCommentData () {
      // 获取推荐页面卡片内容数据
      this.axios.get('/api/getRecommend', {
        params: {
          phone: sessionStorage.getItem('phone')
        }
      })
        .then((response) => {
          this.testList = response.data.data
          console.log(response)
        })
        .catch((error) => {
          this.$Notice.error({
            title: '通知',
            desc: '接口，异常！'
          })
          console.info(error)
        })
    }
  },
  created () {
    this.getNewCommentData()
  }
}
</script>

<style scoped>
  /*@import 'xxx.css';*/
  #homeRecommend{
  }

  .content_left_box{
    width: 695px;
    height: 100%;
    background-color: white;
    float: left;
    box-shadow: 0 1px 3px rgba(26,26,26,.1);
  }

  .left_head_box{
    width: 100%;
    height: 60px;
    border-bottom: 1px solid #f0f2f7;
  }

  .head_btn_box_link{
    width: auto;
    height: 100%;
    float: left;
    margin-right: 20px;
    margin-left: 22px;
  }

  .head_btn_box{
    color: #1a1a1a;
    font-size: 16px;
    text-align: center;
    line-height: 60px;
  }

  .head_btn_box_link:hover .head_btn_box_p{
    color: #175199;
  }

  .left_body_box{
    height: auto;
    width: 100%;
    display: inline-block;
    animation: zoomIn 0.5s ease-in;
  }
</style>
